#ifndef __DomainAcceptor_h__
#define __DomainAcceptor_h__

#include <interfaces/SocketAcceptor.h>
#include "DomainSocket.h"

using namespace Greatewall::Interface;

namespace Greatewall
{
    namespace Network
    {
        class DomainAcceptor : public SocketAcceptor, public DomainSocket
        {
        public:
            DomainAcceptor(SocketEventMonitor& monitor)
                : DomainSocket(monitor)
            {}

            bool
            initDomainAcceptor(std::string& sock_path, int backlog = 10);

            virtual void
            handleInbound();

            virtual bool
            handleOutbound() { return false; }

            // This must be overloaded by the real acceptor who can create the client
            // handler that knows the rule to handle incoming message.
            virtual SystemSocket*
            createClientHandler(SysSockHandler hdl, std::string sock_path, short dummy = 0) = 0;
        };
    }
}
#endif
